<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>修改</title>
    <link href="__STATIC__/component/pear/css/pear.css" rel="stylesheet"/>
</head>
<body class="childrenBody {:dialog_css()}">

<form class="layui-form" action="{:url('category/edit')}" method="post">
    <input type="hidden" name="id" value="{$vo.id}"/>
	<input type="hidden" name="pid" value="{$vo.pid}" />
	<input type="hidden" name="title" value="{$vo.title}" />
	<input type="hidden" name="sign" value="{$vo.sign}" />

	<div class="layui-form-item">
		<label class="layui-form-label">栏目</label>
		<div class="layui-input-block"> &nbsp;<div class="layui-form-mid">{$vo.title}</div></div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">标识</label>
		<div class="layui-input-block"> &nbsp;<div class="layui-form-mid">{$vo.sign}</div></div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">HTML</label>
		<div class="layui-input-block"><textarea name="html_code" id="editor-html" placeholder="请输入HTML代码" class="layui-textarea">{$vo.html_code}</textarea></div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">封面</label>
		<div class="layui-input-block"><input type="hidden" id="thumb" name="thumb" value="{$vo.thumb}" /><div class="upload-image layui-upload-drag aphp-upload" id="ID-upload-image-thumb" data-url="{:url('api/upload')}?api=thumb" data-accept="image" data-field="thumb">{empty $vo['thumb']:}<img id="thumb-preview" src="" style="display:none;" width="90" height="60" alt="thumb">上传封面<span id="thumb-remove" class="remove-pic">删除</span>{else:}<img id="thumb-preview" src="{$vo.thumb}" width="90" height="60" alt="thumb">上传封面<span id="thumb-remove" class="remove-pic" style="display: inline;">删除</span>{/empty}</div><button type="button" class="layui-btn layui-btn-sm" id="thumb-selected" data-url="{:url('attach/selected')}?type=image&dialog=1">图库选择</button></div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">摘要</label>
		<div class="layui-input-block"><textarea name="summary" id="editor-summary" placeholder="请输入摘要" class="layui-textarea">{$vo.summary}</textarea></div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">内容</label>
		<div class="layui-input-block"><textarea name="content" id="editor-content" class="layui-textarea editor-tinymce" placeholder="请输入内容">{$vo.content}</textarea></div>
	</div>

    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                修改
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script src="__STATIC__/component/layui/layui.js"></script>
<script src="__STATIC__/component/pear/pear.js"></script>
<script>
    layui.use(['aphpForm', 'aphp', 'form'], function () {
        var aphpForm = layui.aphpForm,
            aphp = layui.aphp,
            form = layui.form;

        aphpForm.bindEvent('form.layui-form'); // 渲染表单

        form.on('submit(save)', function (data) {
            aphp.request.postForm(data, 0, function () {
				if (window.parent.frames[0].name === 'cms_iframe') {
					parent.location.reload();
				} else {
					parent.layer.close(parent.layer.getFrameIndex(window.name));
					parent.layui.table.reload('currentTable');
				}
            });
            return false;
        });
    })
</script>
</body>
</html>